//------------------------------------------------------------------------------
// <copyright company="Telligent Systems">
//     Copyright (c) Telligent Systems Corporation.  All rights reserved.
// </copyright> 
//------------------------------------------------------------------------------

using System;
using System.Collections;
using CommunityServer.Blogs.Components;
using CommunityServer.Controls;

namespace CommunityServer.Blogs.Controls
{
	/// <summary>
	/// Summary description for AggregateColumn.
	/// </summary>
	public class AggregateColumn : WeblogBaseTemplatedWebControl
	{
		public AggregateColumn()
		{
			//
			// TODO: Add constructor logic here
			//
		}

        AggregateGroupList opmlList = null;
        AggregateGroupList syndicationList = null;
        AggregateGroupList bloggerList = null;
        AggregateGroupList ByGroup = null;

	    protected override void AttachChildControls()
	    {
	        opmlList = FindControl("OpmlList") as AggregateGroupList;
            syndicationList = FindControl("SyndicationList") as AggregateGroupList;
            bloggerList = FindControl("BloggerList") as AggregateGroupList;
            ByGroup = FindControl("ByGroup") as AggregateGroupList;
	    }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            this.EnsureChildControls();

            ArrayList groups = WeblogGroups.GetWeblogGroups(true,false,false);

			if (ByGroup != null)
			{
				ByGroup.DataSource = groups;
				ByGroup.DataBind();
			}

			if (opmlList != null)
			{
				opmlList.DataSource = groups;
				opmlList.DataBind();
			}

			if (syndicationList != null)
			{
				syndicationList.DataSource = groups;
				syndicationList.DataBind();
			}
            
			if (bloggerList != null)
			{
				bloggerList.DataSource = groups;
				bloggerList.DataBind();
			}
        }

	}
}
